
import cmpt = module("main/org/sdmx/model/v2/base/structure/Component");
import cpt = module("main/org/sdmx/model/v2/structure/concept/Concept");
import xal = module("main/org/sdmx/model/v2/base/type/XSAttachmentLevel");

//import org.sdmx.model.v2.base.type.XSAttachmentLevel;
//import org.sdmx.model.v2.structure.concept.Concept;

/**
	* Specifies, in cross-sectional key families, to which level (DataSet,
	* Group, Section, XSObservation) the dimensions and attributes should be 
	* attached.
	* 
	* @author Xavier Sosnovsky, Anthony Morel
	* 
	* @see ComponentList
	* @see org.sdmx.model.v2.base.type.XSAttachmentLevel
	*/
export class XSAttachableComponent extends cmpt.Component
{
	/*==============================Fields================================*/
		
	/**
		* @private
		*/ 
	private _xsAttachmentLevel:string;
		
	/*===========================Constructor==============================*/
		
	constructor(identifier:string, concept:cpt.Concept)
	{
		super(identifier, concept);
	}
		
	/*============================Accessors===============================*/
		
	/**
		* @private
		*/ 
	public setXsAttachmentLevel(level:string)
	{
		if (!(xal.XSAttachmentLevel.contains(level))) {
            throw new Error(level + " not in the list of allowed" + 
				"cross-sectional attachment levels");
		}
		this._xsAttachmentLevel = level;
	}
		
	/**
		* The cross-sectional attachement level of the component
		*/ 
	public getXsAttachmentLevel():string
	{
		return this._xsAttachmentLevel;
	}
}